import request from '@/utils/request'

// 查询新闻
export function listInfo(cid,infotitle,pageindex,pagesize) {
    return request({
      url: 'system/info/find_by_categoryid_paging?categoryid='+ cid + '&infotitle=' + infotitle + '&pageindex=' + pageindex + '&pagesize=' + pagesize,
      method: 'post'
    })
}

// 查询已通过新闻
export function listpassInfo(cid,infotitle,pageindex,pagesize) {
    return request({
      url: 'system/info/find_passed_by_categoryid_paging?categoryid='+ cid + '&infotitle=' + infotitle + '&pageindex=' + pageindex + '&pagesize=' + pagesize,
      method: 'post'
    })
}

// 查询单条新闻
export function oneInfo(id) {
    return request({
      url: 'system/info/findone?infoid='+ id,
      method: 'post'
    })
}


// 添加新闻
export function addInfo(data) {
    return request({
        url: 'system/info/addcustom',
        method: 'post',
        data: data
    })
}

// 修改新闻
export function editInfo(data) {
    return request({
        url: 'system/info/modifycustom',
        method: 'post',
        data: data
    })
}

// 删除新闻
export function delInfo(infoid, catid) {
    return request({
        url: 'system/info/deletecustom?infoid='+ infoid +'&categoryid='+ catid,
        method: 'post'
    })
}

// 添加文件
export function uploadImg(head,data) {
  return request({
      url: '/common/upload',
      method: 'post',
      headers: head,
      data
  })
}

// 修改排序号
export function editNum(id,num) {
    return request({
        url: '/system/infocategoryinfo/editordernum?id=' + id + '&ordernum=' + num,
        method: 'post'
    })
}

// 新增阅读量
export function addNum(id) {
    return request({
        url: '/system/info/addclicknum?infoid=' + id,
        method: 'post'
    })
}

// 修改单位
export function editDept(id,dept) {
    return request({
        url: '/system/info/editdept?infoid=' + id + '&dept=' + dept,
        method: 'post'
    })
}


